#include <bits/stdc++.h>
using namespace std;  int a[110];
  int b[110];
int main() {
  int n, m;
  cin >> n >> m;

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i] == b[j]) {
        a[i] = 0;
        b[j] = 0;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != 0) {
      cout << a[i] << " ";
    }
  }
  return 0;
}